package zdream.control.assets;

import java.util.Arrays;

import zdream.control.region.ItemSpec;

/**
 * @author Zdream
 * @date 2023-12-30
 * @since 0.0.1
 */
public class FoeDescription {
	public String name;
	public String className;
	public Painter painter;
	public ItemSpec spec;

	public static class Painter {
		public String className;
		public int z;
		public TextureDescription[] textures;
		public long flashWhenAgeBiggerThan;
		public PainterHooks[] hooks;
	}

	public static class PainterHooks {
		public String type;
		public String from;
		public String to;
		public String setState;
	}

	public String[] imagePaths() {
		if (painter == null || painter.textures == null) {
			return new String[0];
		}

		return Arrays.stream(painter.textures)
				.filter(texture -> texture.sheets != null)
				.flatMap(texture -> Arrays.stream(texture.sheets))
				.map(sheet -> sheet.imagePath)
				.toArray(String[]::new);
	}

	@Override
	public String toString() {
		return String.format("%s:%s", name, className);
	}
}
